package android.gpsmessenger;

import android.app.Activity;
import android.telephony.SmsManager;
import android.widget.Toast;

public class TextMessenger extends Messenger
{
	TextMessenger(Activity activity)
	{
		super(activity);
	}
	
	public void send(String[] to, String subject, String message)
	{
		try 
		{
			SmsManager smsManager = SmsManager.getDefault();
			
			for (String phoneNum : to)
			{
				smsManager.sendTextMessage(phoneNum, null, message, null, null);
			}
			
			Toast.makeText(getActivity(), "SMS Sent!",Toast.LENGTH_LONG).show();
		} 
		catch (Exception e) 
		{
			Toast.makeText(getActivity(), "SMS faild, please try again later!", Toast.LENGTH_LONG).show();
			e.printStackTrace();
		}
	}
	 
}
